<template>
	<view>
		<topbar title="发布广告" :jt_c="1"  background="background:#FFDE21"></topbar>
		<view class="content">
			<view class="top dis_f_l_c c_7 size_22">请选择分类</view>
			<view class="fen_lei dis_f_co">
				<view class="fl_btn dis_f_sb_c" v-for="(item,index) in cate" @click="go_part1(item.id)">
					<view class="dis_f_l_c">
						<image :src="item.pic" mode=""></image>
						<view>{{item.name}}</view>
					</view>
					<image class="jt_img" src="../../static/index/right.png" mode=""></image>
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cate:[]
			}
		},
		onLoad() {
			this.$.ajax(1, 'post', 'index/guangcate', {
			}, (res) => {
				console.log(res)
				if(res.code == 1){
					this.cate = res.data
				}
				
			})
		},
		methods: {
			go_part1(e){
				this.$.ajax(1, 'post', 'index/checktokens', {
					uid:uni.getStorageSync('uid'),
					token:uni.getStorageSync('token')
				}, (res) => {
					console.log(res)
					if(res.code == 9){
						this.$.ti_shi('token已过期，请重新登陆')
					uni.clearStorageSync()
						setTimeout( () => {
							uni.navigateTo({
								url:'/pages/login/login'
							})
						}, 1000)
					return;
					}
					else{
							this.$.open('/pages/guang_gao/part1?cate='+e)
					}
				})
			
			},
			go_back() {
				this.$.back()
			},
		}
	}
</script>

<style scoped lang="scss">
	.content{
		width: 100%;
		top: calc(var(--status-bar-height) + 88rpx );
		z-index: 998;
		position: absolute;
		.top{
			width: 100%;
			height: 52rpx;
			background-color: #FFF5BC;
			padding-left: 48rpx;
		}
		.fen_lei{
			padding: 36rpx 24rpx;
			width: 100%;
			.fl_btn{
				margin-bottom: 12rpx;
				width: 100%;
				height: 128rpx;
				padding: 30rpx 48rpx 28rpx 48rpx;
				background-color: #fff;
				border-radius: 20rpx;
			}
			image{
				width: 70rpx;
				height: 70rpx;
				margin-right: 24rpx;
			}
			.jt_img{
				width: 20rpx;
				height: 33.79rpx;
			}
		}
	}
</style>
